function echart(id,x,y) {
    let myChart = id;
    var option = {
        color: ['#FFD042'],
        tooltip: {
            trigger: 'axis',
            axisPointer: { // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '3%',
            top: "7%",
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: [{
            type: 'category',
            // data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
            data: x,
            axisTick: {
                alignWithLabel: true
            }
        }],
        yAxis: [{
            type: 'value'
        }],
        series: [{
            name: '直接访问',
            type: 'bar',
            barWidth: 20, //柱图宽度
            // data: [10, 52, 200, 334, 390, 330, 220],
            data: y,
        }]
    };
    myChart.setOption(option);
}

function echart2(id, color2, color3, cnt, status) {
    let myChart = id;
    let option = {
        tooltip: {},
        color: [color2, color3],
        title: {
            text: cnt,
            subtext: status,
            textStyle: {
                color: '#2E48A8',
                fontSize: 28,
                top: '5px'
            },
            subtextStyle: {
                color: '#333',
                fontSize: 14,
                top: '-15px'
            },
            x: 'center',
            y: 'center'
        },
        grid: {
            bottom: 150,
            left: 100,
            right: '10%'
        },
        series: [
            // 主要展示层的
            {
                radius: ['60%', '81%'],
                center: ['50%', '50%'],
                type: 'pie',
                label: {
                    normal: {
                        show: false,
                        formatter: '{b}{d}%',
                        textStyle: {
                            fontSize: 15
                        },
                        position: 'outside'
                    },

                },

                data: [{
                        name: '完成数',
                        value: 1151
                    },
                    {
                        name: '未检查数',
                        value: 620
                    }
                ]
            },
            // 边框的设置
            {
                radius: ['40%', '44%'],
                center: ['50%', '50%'],
                type: 'pie',
                label: {
                    normal: {
                        show: false
                    },
                    emphasis: {
                        show: false
                    }
                },
                labelLine: {
                    normal: {
                        show: false
                    },
                    emphasis: {
                        show: false
                    }
                },
                animation: false,
                tooltip: {
                    show: false
                },
                data: [{
                    value: 1,
                    itemStyle: {
                        color: 'rgba(250,250,250,0.3)'
                    }
                }]
            },
            {
                name: '外边框',
                type: 'pie',
                clockWise: false, //顺时加载
                hoverAnimation: false, //鼠标移入变大
                center: ['50%', '50%'],
                radius: ['65%', '65%'],
                label: {
                    normal: {
                        show: false
                    }
                },
                data: [{
                    value: '',
                    name: '',
                    itemStyle: {
                        normal: {
                            borderWidth: 2,
                            borderColor: '#0b5263'
                        }
                    }
                }]
            }
        ]
    }
    myChart.setOption(option);

}

export default {
    echart,
    echart2
}